#include<bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
const int N = 1e5 + 10;
#define INF 0x3f3f3f3f;
typedef long long int ll;
#define close(); std::ios::sync_with_stdio(false);cin.tie(0),cout.tie(0);
//----------------------------------------------------------------------------//
#define x first
#define y second
typedef pair<int, int> PII;

int n, d, k;
PII logs[N];
int cnt[N];
bool st[N];  // 记录每个帖子是否是热帖,且是在某一时间段的时候

int main()
{
    close();
    cin >> n >> d >> k;
    for (int i = 0; i < n; i ++ ) cin >> logs[i].x >> logs[i].y; //x是时间,y是id

    sort(logs, logs + n);//以时间为第一关键字排序,id为第二关键字

    for (int i = 0, j = 0; i < n; i ++ )//双指针
    {
        int id = logs[i].y;
        cnt[id] ++ ;

        while (logs[i].x - logs[j].x >= d)
        {
            cnt[logs[j].y] -- ;
            j ++ ;
        }

        if (cnt[id] >= k) st[id] = true;
    }

    for (int i = 0; i <= 100000; i ++ )
        if (st[i]) cout << i << '\n';

    return 0;
}

